package com.mima.minaserver.repository;

import java.util.Date;

import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.mima.minaserver.entity.FaultEntity;

@Repository
public interface FaultRepository extends JpaRepository<FaultEntity, String>{

	@Query(value = "select * from t_fault where uuid= ?1", nativeQuery = true)
	public FaultEntity fetchFault(String uuid);
	
	@Modifying
	@Transactional
	@Query(value = "update t_fault set fault_status = ?2,fault_time = NOW() where uuid= ?1", nativeQuery = true)
	public void updateFault(String uuid,int fault_status);
}
